﻿using PEAnalyzer.ModeView.MainPage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;

namespace PEAnalyzer.ValueConvert.MainPage
{
    internal class GridViewBackgroundValueConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            ANALYZE_STATUS status = (ANALYZE_STATUS)value;
            AcrylicBrush brush = null;
            switch (status)
            {
                case ANALYZE_STATUS.ANALYZING:
                    brush = new AcrylicBrush();
                    brush.BackgroundSource = AcrylicBackgroundSource.Backdrop;
                    brush.TintOpacity = 0.5;
                    brush.TintColor = Color.FromArgb(0xFF, 0xAA, 0xAA, 0xAA);
                    break;
                case ANALYZE_STATUS.SUCCESS:
                    brush = new AcrylicBrush();
                    brush.BackgroundSource = AcrylicBackgroundSource.Backdrop;
                    brush.TintOpacity = 0.5;
                    brush.TintColor = Color.FromArgb(0xFF, 0x00, 0xFF, 0x00);
                    break;
                case ANALYZE_STATUS.FAILED:
                    brush = new AcrylicBrush();
                    brush.BackgroundSource = AcrylicBackgroundSource.Backdrop;
                    brush.TintOpacity = 0.5;
                    brush.TintColor = Color.FromArgb(0xFF, 0xFF, 0x00, 0x00);
                    break;
            }

            return brush;
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}
